home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / grafica / amhelios / rad_eqn.h < prev    next >
C/C++ Source or Header  |  1999-01-01  |  4KB  |  124 lines

  1. ////////////////////////////////////////////////////////////
  2. //
  3. //  RAD_EQN.H - Radiosity Equation Solver Base Class Include
  4. //              File
  5. //
  6. //  Version:    1.03A
  7. //
  8. //  History:    94/08/23 - Version 1.00A release.
  9. //              94/09/24 - Added start data member.
  10. //                       - Added GetElapsed function.
  11. //                       - Added GetElapsedTime function
  12. //                         prototype.
  13. //                       - Modified Open function.
  14. //              94/11/26 - Added AddEmittance function
  15. //                         prototype.
  16. //                       - Changed Shade function to
  17. //                         function prototype.
  18. //                       - Deleted "tone_rep.h" include
  19. //                         directive.
  20. //                       - Deleted tone data member.
  21. //              94/12/16 - Version 1.01A release.
  22. //              95/02/05 - Version 1.02A release.
  23. //              95/07/21 - Version 1.02B release.
  24. //              95/09/17 - Changed RadEqnSolve constructor
  25. //                         to initialize max_step to 250.
  26. //              96/02/14 - Version 1.02C release.
  27. //              96/04/01 - Version 1.03A release.
  28. //
  29. //  Compilers:  Microsoft Visual C/C++ Professional V1.5
  30. //              Borland C++ Version 4.5
  31. //
  32. //  Author:     Ian Ashdown, P.Eng.
  33. //              byHeart Software Limited
  34. //              620 Ballantree Road
  35. //              West Vancouver, B.C.
  36. //              Canada V7S 1W3
  37. //              Tel. (604) 922-6148
  38. //              Fax. (604) 987-7621
  39. //
  40. //  Copyright 1994-1996 byHeart Software Limited
  41. //
  42. //  The following source code has been derived from:
  43. //
  44. //    Ashdown, I. 1994. Radiosity: A Programmer's
  45. //    Perspective. New York, NY: John Wiley & Sons.
  46. //
  47. //  It may be freely copied, redistributed, and/or modified
  48. //  for personal use ONLY, as long as the copyright notice
  49. //  is included with all source code files.
  50. //
  51. ////////////////////////////////////////////////////////////
  52.  
  53. #ifndef _RAD_EQN_H
  54. #define _RAD_EQN_H
  55.  
  56. #include <time.h>
  57. #include "environ.h"
  58.  
  59. class RadEqnSolve   // Radiosity equation solver
  60. {
  61.   protected:
  62.     int step_count;         // Step count
  63.     int max_step;           // Maximum number of steps
  64.     double stop_criterion;  // Stopping criterion
  65.     double convergence;     // Convergence
  66.     double total_area;      // Total patch area
  67.     double total_flux;      // Total environment flux
  68.     double total_unsent;    // Total unsent exitance
  69.     char timebuff[10];      // Calculation time string buff
  70.     clock_t start;          // Calculation start time
  71.     BOOL amb_flag;          // Ambient exitance flag
  72.     Environ *penv;          // Environment pointer
  73.     Patch3 *pmax;           // Maximum unsent flux patch ptr
  74.     Spectra ambient;        // Ambient exitance
  75.     Spectra irf;            // Interreflection factors
  76.  
  77.     clock_t GetElapsed() { return (clock() - start); }
  78.     void AddEmittance();
  79.     void CalcAmbient();
  80.     void CalcInterReflect();
  81.     void InitExitance();
  82.     void UpdateUnsentStats();
  83.  
  84.   public:
  85.     RadEqnSolve()
  86.     {
  87.       amb_flag = FALSE;
  88.       max_step = 250;
  89.       stop_criterion = 0.001;
  90.     }
  91.  
  92.     virtual ~RadEqnSolve() { Close(); }
  93.  
  94.     BOOL AmbientFlag() { return amb_flag; }
  95.     BOOL Calculate() { return TRUE; }
  96.     BOOL GetStatus() { return TRUE; }
  97.  
  98.     BOOL Open( Environ * )
  99.     {
  100.       start = clock();
  101.       return TRUE;
  102.     }
  103.  
  104.     BOOL OverShootFlag() { return FALSE; }
  105.     char *GetElapsedTime();
  106.     double GetStopCriterion() { return stop_criterion; }
  107.     double GetConvergence() { return convergence; }
  108.     int GetMaxStep() { return max_step; }
  109.     int GetStepCount() { return step_count; }
  110.     void Close() { }
  111.     void Snapshot() { }
  112.     void DisableAmbient() { amb_flag = FALSE; }
  113.     void DisableOverShoot() { }
  114.     void EnableAmbient() { amb_flag = TRUE; }
  115.     void EnableOverShoot() { }
  116.     void SetMaxStep( int max ) { max_step = max; }
  117.     void SetStopCriterion( double s )
  118.     { stop_criterion = s; }
  119.     void Shade( Environ * );
  120. };
  121.  
  122. #endif
  123.  
  124.